package com.campusevaluation.domain.po;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "evaluation_records")
public class Record {
    @Id
    private String id;
    // 问卷ID
    @Indexed
    private String questionnaireId;
    // 填写用户ID
    @Field("user_id")
    private String userId;
    // 用户所属部门ID
    @Indexed
    private Integer departmentId;
    // 填写问卷答案
    private List<Answer> answers;
    // 是否匿名填写
    private Boolean isAnonymous;
    private Date createTime;

    public static class Answer {
        private String questionId;
        private Object answer;
        @Field("sub_time")
        private Date createTime;
    }
}
